package com.virus.server.utils;

public class StringUtils {

    public static boolean isEmpty(String content) {
        if (content == null || content.isEmpty()) {
            return true;
        }
        return false;
    }

    public static boolean isEmpty(String... content){
        for (String s : content) {
            if (isEmpty(s)){
                return true;
            }
        }
        return false;
    }

    public static String removePrefix(String content, String prefix) {
        if (content == null) {
            return null;
        }
        int i = content.indexOf(prefix);
        if (i == -1) {
            return content;
        }
        return content.substring(i + prefix.length());
    }

    public static String subString(String content, String prefix, String suffix) {
        if (prefix.isEmpty() || suffix.isEmpty() || content.isEmpty()) {
            return null;
        }
        int i = content.indexOf(prefix);
        int j = content.indexOf(suffix, i + 1);
        if (i == -1 || j == -1) {
            return null;
        }
        return content.substring(i + prefix.length(), j);
    }
}
